/**
 * 
 * @author  phoenics@126.com
 * @version v.0.1
 * @date  2018年4月30日 下午7:41:17 
 * 
 */
package phoenics.upservice.repository;

import java.util.List;
import java.util.Optional;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import phoenics.upservice.entity.UserProject;

/**
 *
 */
public interface UserProjectRepository extends PagingAndSortingRepository<UserProject, Long> {
	@Query( value = " select up from UserProject up  where  up.user.id=?1 and up.project.id=?2 " )  
	 Optional< UserProject>  findOneOrder(Long userId,Long projectId);
 //closed
	@Query( value = " select up from UserProject up  where  up.user.id=?1  and  up.userProjectStatus!=0" )  
	 List< UserProject>  closedList(Long userId);
	@Query( value = " select up from UserProject up  where  up.user.id=?1 and up.project.id=?2 and  up.userProjectStatus!=0" )  
	Optional< UserProject>  closedOrder(Long userId,Long projectId);
}
